package STUDENT.TRANDAODAIVI.QUESTION;



class DuckCha2 {
	
	public void swim(){
		System.out.println("Swimm");
	}; 
	public void display(){};
	FlyBehavior2 flyBehavior2;
	QuackBehavior2 quackBehavior2;
	
	public void performFly(){
		flyBehavior2.fly();
	};
	public void performQuack(){
		quackBehavior2.quack();
	};
	
}
class DecoyDuck2 extends DuckCha2 {
	public DecoyDuck2(){
		flyBehavior2=new FlyNoWay2();
		quackBehavior2=new MuteQuack2();
	}
	
	public void display(){
		System.out.println("This is a DecoyDuck");
	}
}
class NormalDuck2 extends DuckCha2 {
	public NormalDuck2(){
		flyBehavior2=new FlyWithWings2();
		quackBehavior2=new Quack2();
	}
	
	public void display(){
		System.out.println("This is a MallardDuck");
	}
}
class RubberDuck2 extends DuckCha2 {
	public RubberDuck2(){
		flyBehavior2=new FlyNoWay2();
		quackBehavior2=new Squeak2();
	}
	public void performFly(){
		flyBehavior2.fly();
	};
	public void performQuack(){
		quackBehavior2.quack();
	};
	
	public void display(){
		System.out.println("This is a MallardDuck");
	}
}
public class Duck2 {
	public static void main(String[] args) {
		//
		NormalDuck2 aduck=new NormalDuck2();
		aduck.display();
		System.out.println("Duck Function: ");
		aduck.swim();
		aduck.performFly();
		aduck.performQuack();
		//
		RubberDuck2 bduck=new RubberDuck2();
		bduck.display();
		System.out.println("Duck Function: ");
		bduck.swim();
		bduck.performFly();
		bduck.performQuack();
		//
		DecoyDuck2 cduck=new DecoyDuck2();
		cduck.display();
		System.out.println("Duck Function: ");
		cduck.swim();
		cduck.performFly();
		cduck.performQuack();
}
}